// 封装请求
import axios from 'axios'
// 请求
const http = axios.create({
  baseURL: '/',
  timeout: 6000,
  headers: {
    // Authorization: 'Bearer eyJhbGciOiJSUzI1NiJ9.eyJzY2hlbWEiOiJkYl9nZHdhdGVyX3RlbmFudF9td3kwMDFfMTEyOSIsInN1YiI6InRlc3QwMSIsImx0ZG5vIjoyMTQsImxvZ2luX3R5cGUiOiJQQyIsInRlbmFudElkIjoxMTI5LCJkZWZhdWx0X2x0ZG5vIjoyMTQsImV4cCI6MTY2MDk0NDE0OSwidXNlcklkIjo4MDAsImlhdCI6MTY2MDg3MjE0OSwidXNlcm5hbWUiOiJ0ZXN0MDEifQ.uWXBEO-SKcri04LHvKCi4G2C8QYiWK3BFsAE0jWQaX9LbLXXJ3eImZYKsNNH3TDX6_UhmKu8YcrhFWxdeioh58TY5kWw4KAbmjbt6aA_NJ5URLnLJWdISNAAHFkUSu1ai44lz1FY3QUzRdlFxUk3G_1LSK3nu5dRlsSVimWXxdk',
    // 'x-ltdno-header': 34072638,
    // 'x-userid-header': 90463,
    // 'x-tenantid-header': 654014,
    // 'x-tenant-schema': 'db_gdwater_tenant_654012',
    // 'x-username-header': 'mwy001',
    'x-tenantid-header': 654012,
    'x-tenant-schema': 'db_gdwater_tenant_654012',
    'x-ltdno-header': 34072638,
  }
})

// axios.interceptors.request.use(config => {
//   // 为请求头对象，添加token验证的Authorization字段
//   console.log('---------')
//   config.headers.Authorization = 'Bearer' + window.sessionStorage.getItem('token')
//   return config
// })

// 封装请求参数
function request({ method = 'get', url, data = {}, params = {}}) {
  return http({
    method,
    url,
    data,
    params,
  })
}
// 返出
export default request